package com.hontech.bread.device

import com.hontech.bread.R
import com.hontech.bread.utils.stringById


object Type {


    const val ACK = 0
    const val PING = 1
    const val PONG = 2
    const val SIMPLE_REQ = 3
    const val SIMPLE_RES = 4
    const val SESSION = 5
    const val REQ = 6
    const val RES = 7
    const val NOTIFY = 8
    const val NOTIFY_ACK = 9
    const val MDB_REQ = 10
    const val MDB_RES = 11
    const val MDB_COIN_NOTIFY = 12
    const val MDB_BILL_NOTIFY = 13
    const val MDB_POS_NOTIFY = 14
}


object Cmd {

    const val QUERY_TASK = 0x00
    const val LOG = 0x01
    const val OTA_START = 0x02
    const val OTA_TRANSLATE = 0x03
    const val OTA_COMPLETE = 0x04
    const val STATUS = 0x05
    const val BREAD_MOTOR_TEST = 0x06
    const val DELIVERY_MOTOR_TEST = 0x07
    const val ROTATION_MOTOR_TEST = 0x08
    const val MIDDLE_PUSH_MOTOR_TEST = 0x09
    const val RIGHT_PUSH_MOTOR_TEST = 0x0A
    const val LEFT_PUSH_MOTOR_TEST = 0x0B
    const val PICK_LED_CTRL = 0x0C
    const val HEAT_CTRL = 0x0D
    const val BUTTON_CTRL_STATUS = 0x0E

}

fun errMsg(ec: Int): String {

    return when (ec) {
        0 -> stringById(R.string.ec_ok)

        1 -> "FLASH ${stringById(R.string.t1733460848_212)}"
        2 -> "STORE FAIL"
        3 -> "${stringById(R.string.t1733460848_213)}"
        4 -> "${stringById(R.string.t1733460848_214)}"
        5 -> "OTA ID${stringById(R.string.t1733460848_215)}"
        6 -> "OTA MD5${stringById(R.string.t1733460848_216)}"
        7 -> "OTA PKG${stringById(R.string.t1733460848_217)}"
        8 -> "MDB${stringById(R.string.t1733460848_218)}"
        9 -> "MDB${stringById(R.string.t1733460848_219)}"

        0x0A -> "MDB${stringById(R.string.t1733460848_220)}"
        0x0B -> "MDB${stringById(R.string.t1733460848_221)}"

        0x0C -> "PT100${stringById(R.string.t1733460848_222)}"
        0x0D -> "PT100 I2C${stringById(R.string.t1733460848_223)}"

        0x0E -> "${stringById(R.string.t1733460848_224)}"

        0x0F -> "${stringById(R.string.t1733460848_225)}"
        0x10 -> "${stringById(R.string.t1733460848_226)}"

        0x11 -> "${stringById(R.string.t1733460848_227)}"
        0x12 -> "${stringById(R.string.t1733460848_228)}"

        0x13 -> "${stringById(R.string.t1733460848_229)}"
        0x14 -> "${stringById(R.string.t1733460848_230)}"

        0x15 -> "${stringById(R.string.t1733460848_231)}"
        0x16 -> "${stringById(R.string.t1733460848_232)}"

        0x17 -> "${stringById(R.string.t1733460848_233)}"
        0x18 -> "${stringById(R.string.t1733460848_234)}"

        0x19 -> "${stringById(R.string.t1733460848_235)}"
        0x1A -> "${stringById(R.string.t1733460848_236)}"

        0x1B -> "${stringById(R.string.t1733460848_237)}"
        0x1C -> "${stringById(R.string.t1733460848_238)}"

        0x1D -> "${stringById(R.string.t1733460848_239)}"

        else -> "${stringById(R.string.ec_def)} $ec"
    }
}




